<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
<body>
<div id="app">
    输入框：<input :type="type">
    <hr>
    <button @click="pwdOrTxt">切换密码框</button>
</div>
<script>
    new Vue({
        el: '#app',
        data: {
            type: 'text'
        },
        methods: {
            pwdOrTxt() {
                this.type = 'password';
            }
        }
    })
</script>
</body>
</html>